﻿define('scheduleTemplateItem',
    ['ko'],
 function (ko) {
     var scheduleTemplateItem = function (t, color) {
         var self = this;
         self.id = ko.observable();
         self.scheduleTemplateId = ko.observable();
         self.startTime = ko.observable();
         self.length = ko.observable();
         self.dayNumber = ko.observable();
         self.scheduleTypeId = ko.observable();
         self.color = ko.observable(color);

         self.load = function(obj) {
             self.id(obj.id);
             self.scheduleTemplateId(obj.scheduleTemplateId);
             self.startTime(obj.startTime.substring(0, 5));
             self.length(obj.length);
             self.dayNumber(obj.dayNumber);
             self.scheduleTypeId(obj.scheduleTypeId);

         };
         
         if (t != null) self.load(t);
     };
     
     return scheduleTemplateItem;
 });
 